' Get the starting balance ' ' initialize QUIT$ ' LET QUIT$ = "N" DO WHILE QUIT$ = "N" ' Handle one transaction ' Determine if user wants to quit PRINT "Do you want to quit? Y or N" READ QUIT$ LOOP ' END
The program has all the details of the loop completed. All you need to do is fill in the statements that make up the two tasks "get the starting balance" and "handle one transaction" and the complete program is finished.
But first, let us test the loop control structure by itself.
Just add two
PRINT
statements.
These statements are sometimes called "dummy statements" because they
are used to fill in for something more complicated.
' get the starting balance ' PRINT "Get starting balance" LET QUIT$ = "N" DO WHILE QUIT$ = "N" ' handle one transaction PRINT "handle one transaction" PRINT "Do you want to quit? Y or N" READ QUIT$ LOOP ' END
Here is one run of the program with dummy statements:
Get starting balance <--- done once handle one transaction <--- dummy task, done as many times as the user wants Do you want to quit? Y or N ? N handle one transaction <--- Do you want to quit? Y or N ? N handle one transaction <--- Do you want to quit? Y or N ? Y
Look at the loop details.